-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feature: add toggle for disable mcp server tool from prompt #3551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: add toggle for disable mcp server tool from prompt #3551
Conversation
🦋 Changeset detectedLatest commit: 34da2f07f094e315fe2fed3899f9bf7a8475b314 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Guys, should i do something more here? |
|
Hey @Rexarrior, Thank you for your contribution. |
|
I really like this, works without any issues. The only thing I would suggest for improvement is the naming of I made the switch look more like the one in Other than that this looks good to me. |
|
Is the test failure legit? |
|
@mrubens |
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
23b08da to
e757bd4
Compare
|
@mrubens |
* add toggle for disable mcp server tool from prompt * languages * fix error message * Update src/core/prompts/instructions/create-mcp-server.ts Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * fix build * typo * refactor: make the switch style consistent * respect review * refactor: improve layout and styling in McpToolRow component * fix: update new mcp tests * tailwind css for disabledTool swipper * id locale (from main) * fix: improve error message for updating tool settings * fix: specify type for serverConfigData as Record<string, any> * fix: enhance UI layout and improve accessibility for tool controls * fix: migrate jest.Mock to vitest Mock type * Update .changeset/slimy-years-smell.md * fix: replace enabled switch with button --------- Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> Co-authored-by: Daniel <[email protected]> Co-authored-by: Daniel Riccio <[email protected]> Co-authored-by: Matt Rubens <[email protected]>
Related GitHub Issue
Closes: #3346
Description
This PR introduces a new feature allowing users to toggle whether an individual MCP (Model Context Protocol) tool is included in the context provided to the AI model. This gives users finer-grained control over which tools the AI can see and potentially use.
The changes include:
McpHub.ts):disabledForPromptToolsarray to the MCP server configuration inmcp.json(both project and global).toggleToolEnabledForPromptmethod to add/remove tool names from thisdisabledForPromptToolslist.fetchToolsListto populate anenabledForPromptboolean on each tool object based on whether it's in thedisabledForPromptToolslist.mcp-servers.ts):tool.enabledForPromptflag.webviewMessageHandler.ts,WebviewMessage.ts):toggleToolEnabledForPromptmessage type and handler to facilitate communication between the webview UI and the extension backend.mcp.ts):enabledForPrompt?: booleanto theMcpTooltype.McpToolRow.tsx,mcp.jsoni18n):Test Procedure
Unit Tests:
McpHub.test.ts:Manual Testing Steps:
a. Locate the new toggle switch next to each tool (it might look like a slider).
b. Verify Initial State: Observe the initial state of the toggles.
c. Toggle Off: Click the toggle for a specific tool to disable its inclusion in the prompt.
i. Check the corresponding
mcp.jsonfile (either project's.roo/mcp.jsonor global MCP settings) to ensure the tool's name is added to thedisabledForPromptToolsarray for that server.ii.Verify that when a prompt is generated that would normally include MCP tools, this specific tool is now omitted from the context.
d. Toggle On: Click the toggle again for the same tool to re-enable its inclusion in the prompt.
i. Check the
mcp.jsonfile again to ensure the tool's name is removed from thedisabledForPromptToolsarray.ii. Verify the tool is now included in the prompt context.
.roo/mcp.json) and global MCP configurations if applicable.Type of Change
srcor test files.Pre-Submission Checklist
npm run lint).console.log) has been removed.npm test).mainbranch.npm run changesetif this PR includes user-facing changes or dependency updates.Screenshots / Videos
Before:

[Link to Before Screenshot/Video - e.g., showing the MCP tool row without the new toggle]
After:

[Link to After Screenshot/Video - e.g., showing the MCP tool row WITH the new toggle, and demonstrating its on/off states]
Documentation Updates
Additional Notes
This feature enhances user control over the AI's context, potentially improving relevance and reducing token usage by excluding unnecessary tools from prompts.
Important
Add toggle feature for MCP tool visibility in AI prompts, with updates to core logic, UI, and tests.
McpHub.ts):disabledForPromptToolsarray inmcp.jsonfor tool management.toggleToolEnabledForPromptto manage tool visibility in prompts.fetchToolsListto setenabledForPromptflag.mcp-servers.ts):enabledForPrompt.webviewMessageHandler.ts,WebviewMessage.ts):toggleToolEnabledForPromptmessage type for UI-backend communication.mcp.ts):enabledForPrompttoMcpTooltype.McpToolRow.tsx,mcp.jsoni18n):McpHub.test.ts):disabledForPromptTools.This description was created by
for 765157e0ed73cefff3af36d18eaf19ebbe858155. You can customize this summary. It will automatically update as commits are pushed.